<?php
session_start();
$xym=trim($_POST[verification]);

?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?
include "mysql_connect.php";
include "inc/func.php";
$sqlstr = "select userid,username from tb_users where userid = '".$_POST['first_name']."' and pwd = SHA('".$_POST['pwd']."')";
$result = mysql_query($sqlstr,$dbc);
$record = mysql_fetch_row($result);     
 if($record != "")
	{       if(strval($xym)!=$_SESSION["autonum1"])
			 echo "<script>alert('验证码输入错误');history.go(-1);</script>";
			else{	
			if($_SESSION["userid"]!=""){
			  session_unregister("userid");
			 }   
          
             session_register("userid");
			
			$_SESSION["userid"] = $record[0];
			
			//$_SESSION["first_name"] = $_POST['first_name'];
			$lastlogintime=strtotime("now");
			mysql_query("update tb_users set lastlogintime='".$lastlogintime."'  where userid='".$_SESSION["userid"]."'",$dbc);
			echo "<script>alert('欢迎光临');location='/l_library/rsxx/p_manage.php';</script>";
	}
	}
	else
		echo "<script>alert('用户名或密码错误');history.go(-1);</script>";
	mysql_close($dbc);   
?>